//
//  UserModel.m
//  YXFinance
//
//  Created by uplooking on 2018/10/22.
//  Copyright © 2018年 CRLong. All rights reserved.
//

#import "UserModel.h"

@implementation UserModel

+ (instancetype)initWithDictionary:(NSDictionary *)dictionary{
    
    
    UserModel * model = [[UserModel alloc]init];
    
    model.userDic = dictionary;
    model.user_id = [dictionary[@"user_id"] returnString];
    model.user_name = [dictionary[@"user_name"] returnString];
    model.full_name = [dictionary[@"full_name"] returnString];
    model.sex = [dictionary[@"sex"] returnString];
    model.token = [dictionary[@"token"] returnString];
    model.nickname = [dictionary[@"nickname"] returnString];
    model.avatar = [dictionary[@"avatar"] returnString];
    model.password = [dictionary[@"password"] returnString];
    model.mobile = [dictionary[@"mobile"] returnString];
    model.intro = [dictionary[@"intro"] returnString];
    model.teacher_id = [dictionary[@"teacher_id"] returnString];
    model.addr = [dictionary[@"addr"] returnString];
    model.area = [dictionary[@"area"] returnString];
    model.idcard = [dictionary[@"idcard"] returnString];
    model.regtime = [dictionary[@"regtime"] returnString];
    model.regip = [dictionary[@"regip"] returnString];
    model.logtime = [dictionary[@"logtime"] returnString];
    model.logip = [dictionary[@"logip"] returnString];
    model.status = [dictionary[@"status"] returnString];
    model.signup = dictionary[@"signup"];
    
    if ([dictionary[@"signup_info"] isKindOfClass:[NSDictionary class]]) {
        
        model.signup_info = [SignupInfoModel initWithDictionary:dictionary[@"signup_info"]];
    }
 
    return model;
}

@end

@implementation SignupInfoModel

+ (instancetype)initWithDictionary:(NSDictionary *)dictionary{
    
    SignupInfoModel * model = [[SignupInfoModel alloc]init];
    
    model.s_id = dictionary[@"id"];
    model.mobile = dictionary[@"mobile"];
    
    NSString * account = dictionary[@"account"];
    
    if (account.length == 0) {
        
        model.account = @"";
        
    }else{
       
        account =  [account substringToIndex:8];
        model.account = [NSString stringWithFormat:@"%@****",account];
    }

    
    NSDictionary * dic = dictionary[@"teacher"];
    model.teacher = [TeacherIndexModel initWithDictionary:dic];
    
    return model;
}

@end
